#include <fstream>
#include <iostream>
#include "point.h"

using namespace std;

int main()
{
	std::istream& in(cin);
	std::ostream& out(cout);

	int n;
	in >> n;

	vector<point> points;
	for (int i = 0; i < n; i++)
	{
		double x, y;
		in >> x >> y;
		points.push_back(point(x, y));
	}
	
	vector<point> result = convex_hull(points.begin(), points.end());
	out << result.size() << "\n";
	
	for (auto i : result)
		out << i.x.get_d() << " " << i.y.get_d() << "\n";
}
